--Agregar restriccion de not null en campos de configuracion de negdet --
update negcfg set pidevenzon1 = 'N' where pidevenzon1 is null;
update negcfg set pidevenzon2 = 'N' where pidevenzon2 is null;
update negcfg set pidevenzon3 = 'N' where pidevenzon3 is null;
update negcfg set pidevenzon4 = 'N' where pidevenzon4 is null;

update negcfg set pideccos1 = 'N' where pideccos1 is null;
update negcfg set pideccos2 = 'N' where pideccos2 is null;
update negcfg set pideccos3 = 'N' where pideccos3 is null;
update negcfg set pideccos4 = 'N' where pideccos4 is null;

update negcfg set fechaproxobligatoria = 'N' where fechaproxobligatoria is null;

ALTER TABLE negcfg
  ALTER COLUMN pidevenzon1 SET NOT NULL,
  ALTER COLUMN pidevenzon2 SET NOT NULL,
  ALTER COLUMN pidevenzon3 SET NOT NULL,
  ALTER COLUMN pidevenzon4 SET NOT NULL,

  ALTER COLUMN pideccos1 SET NOT NULL,
  ALTER COLUMN pideccos2 SET NOT NULL,
  ALTER COLUMN pideccos3 SET NOT NULL,
  ALTER COLUMN pideccos4 SET NOT NULL,

  ALTER COLUMN tipopada SET NOT NULL,
  ALTER COLUMN codpadr SET NOT NULL,

  ALTER COLUMN fechaproxobligatoria SET NOT NULL;


--Agregar restriccion de not null en campo idpad de neg --

--delete from neg where idpad is null;
ALTER TABLE neg
ALTER COLUMN idpad SET NOT NULL;

-- =====================================
SELECT aaVersion('407.02');
-- =====================================


